package com.java.demo.controller;

import com.java.demo.entity.User;
import com.java.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Controller;

import javax.annotation.Resource;

@Controller
public class UserController2 {

//    @Autowired
//    private User user;

//    @Resource
//    private UserService userService;

   // @Resource(name = "user1")
   //  ||
    @Autowired
    @Qualifier(value = "user1")
    private User user;

    public void sayHi() {
        System.out.println("com.java-> do UserController sayHi()");
        System.out.println(user.getName());
    }
}